{extend name="iframe" /}
{block name="css"}
{css href="__CSS__/user.css,__LIB__/css/dplayer.min.css" /}
{/block}
{block name="body"}
<!-- 主要内容 开始 -->
<div class="weui-tab_bd-item">
  <header class="weui-navBar weui-navBar-fixed">
    <a href="javascript:;" class="weui-navBar-item">
    </a>
    <div class="weui-center">
    </div>
    <a href="info.html" class="weui-navBar-item">
      <i class="icon iconfont icon-shezhi1 f-white"></i>
    </a>
  </header>
  <div class="b-green">
    <div class="weui-cell head-cells">
      <div class="weui-cell__hd" width="60px">
        <img src="{$info.avatarurl|default='/static/images/logo-white.png'}" width="60px" alt="">
      </div>
      <div class="weui-cell__bd flex flex-v">
        <h4 class='f-white'>{if $info.is_real}{$info.real_name|substr_replace='*',3,3}{elseif $info.nick_name}{$info.nick_name|default=''}{elseif $info.name}{$info.name|default=''}{else}未设置{/if}</h4>
        <span class="icon iconfont icon-huiyuan f-gold">{if $info.grade eq 5}<span class="layui-badge layui-badge-blue">总代{elseif $info.grade eq 4}<span class="layui-badge layui-badge-cyan">省代{elseif $info.grade eq 3}<span class="layui-badge layui-badge-yellow">市代{elseif $info.grade eq 2}<span class="layui-badge layui-badge-green">县代{elseif $info.grade eq 1}<span class="layui-badge layui-badge-red">店家{else}<span class="layui-badge layui-badge-gray">会员{/if}</span>
        <button class="btn_sign open-popup" data-target="#sign">签到</button>
      </div>
      <div class="weui-cell__ft open-popup" data-target="#qrcode">
        <i class="icon iconfont icon-erweima1 f-white"></i>
      </div>
    </div>
  </div>
  <div class="weui-flex">
    <div class="weui-flex-box">
      <h2>我的服务</h2>
    </div>
  </div>
  <div class="weui-grids">
    <div data-url="pay.html" class="weui-grid">
      <div class="weui-grid-icon">
        <svg class="icon svg-icon" aria-hidden="true">
          <use xlink:href="#icon-jilu"></use>
        </svg>
      </div>
      <div class="weui-grid-text">
        <h2>支付服务</h2>
      </div>
    </div>
    <div data-url="team.html" class="weui-grid">
      <div class="weui-grid-icon">
        <svg class="icon svg-icon" aria-hidden="true">
          <use xlink:href="#icon-dangan"></use>
        </svg>
      </div>
      <div class="weui-grid-text">
        <h2>我的社区</h2>
      </div>
    </div>
    <div data-url="invite.html" class="weui-grid">
      <div class="weui-grid-icon">
        <svg class="icon svg-icon" aria-hidden="true">
          <use xlink:href="#icon-bingli"></use>
        </svg>
      </div>
      <div class="weui-grid-text">
        <h2>邀请好友</h2>
      </div>
    </div>
    <div data-url="orders.html" class="weui-grid">
      <div class="weui-grid-icon">
        <svg class="icon svg-icon" aria-hidden="true">
          <use xlink:href="#icon-baogao"></use>
        </svg>
      </div>
      <div class="weui-grid-text">
        <h2>我的订单</h2>
      </div>
    </div>
  </div>
  <div class="weui-cell weui-cell_access" data-url="authorize.html">
    <div class="weui-cell__hd">
      <svg class="icon svg-icon" aria-hidden="true">
        <use xlink:href="#icon-renzheng"></use>
      </svg>
    </div>
    <div class="weui-cell__bd">
      <p>实名认证</p>
    </div>
    <div class="weui-cell__ft">身份认证</div>
  </div>
  <div class="weui-cell weui-cell_access" data-url="modify.html">
    <div class="weui-cell__hd">
      <svg class="icon svg-icon" aria-hidden="true">
        <use xlink:href="#icon-anquan"></use>
      </svg>
    </div>
    <div class="weui-cell__bd">
      <p>账户安全</p>
    </div>
    <div class="weui-cell__ft">密码修改</div>
  </div>
  <div class="weui-cell weui-cell_access" data-url="address.html">
    <div class="weui-cell__hd">
      <svg class="icon svg-icon" aria-hidden="true">
        <use xlink:href="#icon-dizhi"></use>
      </svg>
    </div>
    <div class="weui-cell__bd">
      <p>地址管理</p>
    </div>
    <div class="weui-cell__ft">收货地址</div>
  </div>
  <div class="weui-cell weui-cell_access" data-url="mail.html">
    <div class="weui-cell__hd">
      <svg class="icon svg-icon" aria-hidden="true">
        <use xlink:href="#icon-linggan"></use>
      </svg>
    </div>
    <div class="weui-cell__bd">
      <p>留言反馈</p>
    </div>
    <div class="weui-cell__ft">建议灵感</div>
  </div>
  <div class="weui-cell weui-cell_access" data-url="app.html">
    <div class="weui-cell__hd">
      <svg class="icon svg-icon" aria-hidden="true">
        <use xlink:href="#icon-fenxiang1"></use>
      </svg>
    </div>
    <div class="weui-cell__bd">
      <p>客户端</p>
    </div>
    <div class="weui-cell__ft">APP下载</div>
  </div>
  <div class="weui-cell weui-cell_access" data-url="logout.html">
    <div class="weui-cell__hd">
      <svg class="icon svg-icon" aria-hidden="true">
        <use xlink:href="#icon-shuoming"></use>
      </svg>
    </div>
    <div class="weui-cell__bd">
      <p>退出</p>
    </div>
    <div class="weui-cell__ft"></div>
  </div>
  <div style="height: 44px;"></div>
  <div class="divFooter"></div>
</div>

<!--弹出二维码-->
<div id="qrcode" class="weui-popup__container popup-bottom">
  <div class="weui-popup__overlay"></div>
  <div class="weui-popup__modal">
    <div class="weui-popup">
      <div class='demos-header'>
        <h1 class="demos-title">我的邀请码！</h1>
      </div>
      <div class="myqrcode"></div>
      <p class="weui-msg__desc">扫一扫上面的二维码图案，注册用户</p>
    </div>
  </div>
</div>
<!--弹出签到-->
<div id="sign" class="weui-popup__container popup-bottom">
  <div class="weui-popup__overlay"></div>
  <div class="weui-popup__modal">
    <div class="weui-popup">
      <div class='demos-header'>
        <h1 class="demos-title">{$data.video.name|default='签到视频'}</h1>
      </div>
      <div id="dplayer"></div>
      <p class="weui-msg__desc">视频观看结束自动签到</p>
    </div>
  </div>
</div>
<!-- 主要内容 结束 -->
{/block}
{block name="js"}
{js href="__JS__/jquery.qrcode.min.js,__LIB__/js/dplayer.min.js" /}
<script type="text/javascript">
  $(function(){
    $('.weui-cell_access,.weui-grid').click(function() {
      var title = $(this).find('p,h2').text();
      var url = $(this).data('url');
      if(!url) return $.toast(title+'开发中','text');
      $(location).attr('href', url);
    });
    //二维码
    $('.myqrcode').qrcode({
      width: 180,
      height: 180,
      correctLevel: 0,
      text: '{$Request.domain}/register/code/{$info.share_code}.html'
    });
    const dp = new DPlayer({
      container: document.getElementById('dplayer'),
      autoplay: false, // 自动播放
      theme: '#FADFA3', // 主题
      loop: false, // 循环播放
      lang: 'zh-cn', // 语言
      screenshot: true, // 截图
      hotkey: true, // 热键
      preload: 'auto', // 预加载
      // logo: '__IMG__/ios.png', // 左上角logo
      volume: 0.7, // 音量
      mutex: true, // 多个视频互斥
      video: {
        url: "{$data.video|default=''}"
      }
    });
    //播放完成签到
    dp.on('ended', function () {
      $.post('sign.html', function(res) {
        if (res.code === 1) {
            $.alert({
              title: '恭喜您',
              text: '签到成功，连续签到有惊喜哟！',
              onOK: function () {
                setTimeout(function(){
                  location.href = res.url;
                },600);
              }
            });
          } else {
            $.toptip(res.msg);
          }
      });
    });
    //关闭签到窗口视频暂停
    $(document).on("click", ".close-popup, .weui-popup__overlay", function() {
      dp.pause();
    })
    .on("click", ".btn_sign", function() {
      dp.play();
    });
  });
</script>
{/block}